package com.weifangfirecontrolformal.weifangfirecontrolformal.web.service.internetofthings.firefightingiot;

import cn.hutool.json.JSONObject;
import com.weifangfirecontrolformal.weifangfirecontrolformal.common.base.BaseService;
import com.weifangfirecontrolformal.weifangfirecontrolformal.support.model.RespEntity;
import com.weifangfirecontrolformal.weifangfirecontrolformal.support.utils.requestutil.HttpRequestUtil;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

@Service
@Slf4j
public class FireAlarmInfoService extends BaseService {

	private static final Logger logger = LoggerFactory.getLogger(FireAlarmInfoService.class);

	/**
	 * 历史报警信息列表查询
	 * @param
	 * @return
	 */
	public RespEntity listHistoricalAlarmInfoListPage(JSONObject jsonParam) {
		jsonParam = HttpRequestUtil.commonHttpRequestParamConvert(getRequest());
		return fireFightingiotJava(jsonParam,"listHistoricalAlarmInfoListPage","alarmInfo");
	}

	/**
	 * 字典组查询（目前用到所有系统的列表查询）
	 * @param
	 * @return
	 */
	public RespEntity dictList(JSONObject jsonParam) {
		jsonParam = HttpRequestUtil.commonHttpRequestParamConvert(getRequest());
		return fireFightingiotJava(jsonParam,"dictList","alarmInfo");
	}
	/**
	 * 报警类型分组名称
	 * @param
	 * @return
	 */
	public RespEntity getAlarmTypeGroupName(JSONObject jsonParam) {
		jsonParam = HttpRequestUtil.commonHttpRequestParamConvert(getRequest());
		return fireFightingiotJava(jsonParam,"getAlarmTypeGroupName","alarmInfo");
	}
	/**
	 * 处置功能
	 * @param
	 * @return
	 */
	public RespEntity handle(JSONObject jsonParam) {
		jsonParam = HttpRequestUtil.commonHttpRequestParamConvert(getRequest());

		return fireFightingiot(jsonParam,"handle","alarmInfo");
	}

	/**
	 * 报警信息详情
	 * @param
	 * @return
	 */
	public RespEntity detail(JSONObject jsonParam) {
		jsonParam = HttpRequestUtil.commonHttpRequestParamConvert(getRequest());
		//return fireFightingiot(jsonParam,"detail","alarmInfo");
		return fireFightingiotJava(jsonParam,"detail","alarmInfo");
	}

	/**
	 * 报警日志添加
	 * @param
	 * @return
	 */
	public RespEntity add(JSONObject jsonParam) {
		jsonParam = HttpRequestUtil.commonHttpRequestParamConvert(getRequest());

		return fireFightingiot(jsonParam,"add","alarmInfo");
	}

	/**
	 * 导出报警信息
	 * @param
	 * @return
	 */
	public RespEntity export(JSONObject jsonParam) {
		jsonParam = HttpRequestUtil.commonHttpRequestParamConvert(getRequest());

		return fireFightingiot(jsonParam,"export","alarmInfo");
	}

	/**
	 * 处置模块分类功能(总历史记录点处置时触发)
	 * @param
	 * @return
	 */
	public RespEntity typeHandle(JSONObject jsonParam) {
		jsonParam = HttpRequestUtil.commonHttpRequestParamConvert(getRequest());

		return fireFightingiotJava(jsonParam,"typeHandle","alarmInfo");
	}
	/**
	 * 一键处置
	 * @param
	 * @return
	 */
	public RespEntity oneClickHandle(JSONObject jsonParam) {
		jsonParam = HttpRequestUtil.commonHttpRequestParamConvert(getRequest());

		return fireFightingiotJava(jsonParam,"oneClickHandle","alarmInfo");
	}
	/**
	 * 判断是否有未读报警信息接口(单位用)
	 * @param
	 * @return
	 */
	public RespEntity isHaveUnReadLog(JSONObject jsonParam) {
		jsonParam = HttpRequestUtil.commonHttpRequestParamConvert(getRequest());
		return fireFightingiot(jsonParam,"isHaveUnReadLog","alarmInfo");
	}

	/**
	 * 日志改为已读状态
	 * @param
	 * @return
	 */
	public RespEntity updateUnReadState(JSONObject jsonParam) {
		jsonParam = HttpRequestUtil.commonHttpRequestParamConvert(getRequest());

		return fireFightingiot(jsonParam,"updateUnReadState","alarmInfo");
	}

    /**
     * 前端是否对这个用户做报警处理
     * @param
     * @return
     */
    public RespEntity isAlarm(JSONObject jsonParam) {
        jsonParam = HttpRequestUtil.commonHttpRequestParamConvert(getRequest());

        return fireFightingiotJava(jsonParam,"isAlarm","alarmInfo");
    }

	/**
	 * 烟感报警消音
	 * @param jsonParam
	 * @return
	 */
	public RespEntity alarmSilencer(JSONObject jsonParam) {
		jsonParam = HttpRequestUtil.commonHttpRequestParamConvert(getRequest());

		return fireFightingiotJava(jsonParam,"alarmSilencer","alarmInfo");
	}

	/**
	 * 查询是否存在未处置消息
	 * @param
	 * @return
	 */
	public RespEntity alarmCount(JSONObject jsonParam) {
		jsonParam = HttpRequestUtil.commonHttpRequestParamConvert(getRequest());

		return fireFightingiotJava(jsonParam,"alarmCount","alarmInfo");
	}

	/**
	 * 报警事件列表
	 * @param
	 * @return
	 */
	public RespEntity eventList(JSONObject jsonParam) {
		jsonParam = HttpRequestUtil.commonHttpRequestParamConvert(getRequest());

		return fireFightingiotJava(jsonParam,"eventList","alarmInfo");
	}

	/**
	 * 报警日历数据
	 * @param
	 * @return
	 */
	public RespEntity alarmCalendarList(JSONObject jsonParam) {
		jsonParam = HttpRequestUtil.commonHttpRequestParamConvert(getRequest());

		return fireFightingiotJava(jsonParam,"alarmCalendarList","alarmInfo");
	}

}
